vec4 gaussFilter(sampler3D volume, in VOLUME_STRUCT volumeStruct, in vec3 sampleOrg, const float sigma) {
	const int radius = 2;
	float s = 2 * sigma * sigma;
	vec3  e = vec3(2.7182818284);
	float c = 1 / (sigma * sqrt(2 * 3.1415926535));
	vec4 result = getVoxel(volume, volumeStruct, sampleOrg);
	if (radius < 1) return result;
	
	vec3 samplePoint = sampleOrg * volumeStruct.datasetDimensions_;
	vec3 pivotPoint = round(samplePoint);
	vec3 distance = samplePoint - pivotPoint;
	const float eps = 0.001;
	if (length(distance) < eps) return result;

	result.a = 0.0;
	const int width = 2 * radius + 1;
	
	int pos;
	vec3 arg;
	vec3 gauss[width];
	for (int i = -radius; i <= radius; i++) {
		pos = i + radius;
		arg = distance - i;
		gauss[pos] = c * pow(e, -(arg * arg) / s);
	}


	// convolution-sum (3D)
	for (int x = -radius; x <= radius; x++) {
        for (int y = -radius; y <= radius; y++) {
            for (int z = -radius; z <= radius; z++) {
				result.a += getVoxel(volume, volumeStruct, (pivotPoint + vec3(x, y, z)) / volumeStruct.datasetDimensions_).a  
							* gauss[x + radius].x * gauss[y + radius].y * gauss[z + radius].z;
			}
		}
	}

	return result;
}